using System;

namespace Chambills.Present.Core
{
    public class Disposable : IDisposable
    {
        ///<summary>
        /// Performs application-defined tasks associated with freeing, releasing, or
        /// resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        /// <summary>
        /// Disposes the object.
        /// </summary>
        ///
        protected virtual void Dispose(bool disposing)
        {
            if (false == IsDisposed)
            {
                DisposeNativeResources();

                if (disposing)
                {
                    DisposeManagedResources();
                }

                IsDisposed = true;
            }
        }

       
        ~Disposable()
        {
            Dispose(false);
        }

        protected virtual void DisposeManagedResources()
        {
        }

        protected virtual void DisposeNativeResources()
        {
            

        }


        public bool IsDisposed { get; set; }

    }
}